package com.salton123.soulove.sailfish.db

import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.salton123.app.BaseApplication

/**
 * Time:8/26/21 4:28 PM
 * Author:
 * Description:
 */
@Database(entities = [VideoItem::class, DirItem::class], version = 2, exportSchema = false)
abstract class SailfishDatabase : RoomDatabase() {
    abstract fun videoDao(): VideoDao

    companion object {
        private const val DB_NAME = "sailfish.db"
        val Impl: SailfishDatabase by lazy {
            Room.databaseBuilder(BaseApplication.sInstance, SailfishDatabase::class.java, DB_NAME)
                .setJournalMode(JournalMode.WRITE_AHEAD_LOGGING)
                .fallbackToDestructiveMigration()
                .build()
        }
    }
}